{extend name="base" /}
{block name="content"}
<ol class="breadcrumb" style="background-color: #f9f9f9;padding:8px 0;margin-bottom:10px;">
    <li>
        <a href=""><i class="fa fa-cogs"></i>
            站点管理</a>
    </li>
    <li class="active">
        <a href="">站点配置</a>
    </li>
</ol>
<ul class="nav nav-tabs" role="tablist">
    <li class="active"><a href="#tab1">站点配置</a></li>
</ul>
<form action="" method="post">
    <div class="panel panel-default">
        <div class="panel-body">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th width="5%">编号</th>
                    <th>配置名称</th>
                    <th width="20%">配置值</th>
                    <th >描述</th>
                </tr>
                </thead>
                <tbody>
                {foreach name="list" item="v"}
                <tr>
                    <td>{$v['webset_id']}</td>
                    <td>{$v['webset_name']}</td>
                    <td>
                        <input type="text" class="form-control" old="{$v['webset_value']}" value="{$v['webset_value']}" onblur="change(this,{$v['webset_id']})">
                    </td>
                    <td>{$v['webset_des']}</td>
                </tr>
                {/foreach}
                </tbody>
            </table>
        </div>
    </div>
</form>
<div class="pagination pagination-sm pull-right">
{$list->render()}
</div>
<script type="text/javascript">
    function change(obj,webset_id) {
        var webset_value =$(obj).val();
        var old = $(obj).attr("old");
        if(old != webset_value) {
            $.post("{:url('edit')}", {webset_value: webset_value, webset_id: webset_id}, function (result) {
                if (result['code']) {
                    util.message(result['msg'], "refresh", "success");
                } else {
                    util.message(result['msg'], "back", "error");
                }
            }, "json");
        }
    }
</script>
{/block}
